{% extends "common/base.side.html" %}

{% block title %}
    Edit Blog
{% endblock %}

{% block rcontent %}
    <div class="btn-toolbar">
        <div class="btn-group">
            {% url "addblogurl" as theaddblogurl %}
            <a class="btn btn-default {% if request.path == theaddblogurl %} active {% endif %}"
               href={{ theaddblogurl }}><span class="glyphicon glyphicon-edit"></span>新增博客</a>
            {% url "bloglisturl" as thelistblogurl %}
            <a class="btn btn-default {% if request.path == thelistblogurl %} active {% endif %}"
               href={{ thelistblogurl }}><span class="glyphicon glyphicon-list"></span>文章列表</a>
        </div>
    </div>

    <hr/>

    <form class="form-horizontal" role="form" action={% url "editblogurl" ID %} method="POST" onSubmit="enablePath();">
        {% csrf_token %}

        {% for item in form %}
            <div class="form-group">
                <label class="control-label col-md-1">{{ item.label }}</label>

                <div class="col-md-2">
                    {{ item }}
                </div>
                <div class="col-md-offset-1 col-md-10">
                    {{ item.errors }}
                </div>
            </div>
        {% endfor %}

        <div class="form-group">
            <div class="col-md-offset-1 col-md-10">
                <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确认更新吗？')">更 新</button>
                <div>
                </div>
    </form>
    <script>
        jQuery(function ($) {
            $('form').bind('submit', function () {
                $(this).find(':input').prop('disabled', false);
            });
        });
    </script>
{% endblock %}
